import {debounce} from '../components/common/utils.js'
import BackTop from '../components/content/backTop/BackTop.vue'
export const itemListenerMixin = {
  data(){
    return {
     itemImgListener : null
    }
  },
   mounted(){
     const refresh = debounce(this.$refs.scroll.refresh,200)
     this.itemImgListener = ()=>{
       refresh();
       console.log("我是mixin的refresh()")

     }
     this.$bus.$on("itemImageLoad",this.itemImgListener)
     console.log('我是混入中的内容')

   }
}

export const backTopMixin = {
  data(){
    return {
      isShowBackTop : false
    }
  },
  methods : {
    backTop(){
      this.$refs.scroll.scrollTo(0,0,300)
    },
    listenShowBackTop(){
      this.isShowBackTop = -position.y > BACK_POSITION
    }
  },
  components : {
    BackTop
}
}